﻿using System.Web.Mvc;
using System;
using System.Web.UI;
using System.IO;
using System.Configuration;
namespace GBlog.Core.Recaptcha
{
    public static class RecaptchaControlMvc
    {
        private static string publicKey;
        private static string privateKey;
        private static bool skipRecaptcha;
        public static string PublicKey
        {
            get
            {
                return RecaptchaControlMvc.publicKey;
            }
            set
            {
                RecaptchaControlMvc.publicKey = value;
            }
        }
        public static string PrivateKey
        {
            get
            {
                return RecaptchaControlMvc.privateKey;
            }
            set
            {
                RecaptchaControlMvc.privateKey = value;
            }
        }
        public static bool SkipRecaptcha
        {
            get
            {
                return RecaptchaControlMvc.skipRecaptcha;
            }
            set
            {
                RecaptchaControlMvc.skipRecaptcha = value;
            }
        }
        static RecaptchaControlMvc()
        {
            RecaptchaControlMvc.publicKey = ConfigurationManager.AppSettings["Recaptcha_Public_Key"];
            RecaptchaControlMvc.privateKey = ConfigurationManager.AppSettings["Recaptcha_Private_Key"];
            if (!bool.TryParse(ConfigurationManager.AppSettings["RecaptchaSkipValidation"], out RecaptchaControlMvc.skipRecaptcha))
            {
                RecaptchaControlMvc.skipRecaptcha = false;
            }
        }
    }
}